<template>
	<view class="page">
		<view class="title">
			<text class="text">产品建议</text>
			<text class="small">（出现问题）</text>
		</view>
		<view class="">
			<textarea class="textarea" v-model="message" placeholder="感谢您对产品提出的宝贵意见,我们会尽快优化产品,提升用户体验" />
		</view>
		<view class="btn5" @click="submit">提交反馈</view>
		<view class="title">
			<text class="text">常见问题</text>
		</view>
		<uni-list>
			<uni-list-item v-for="item in questions" :key="item.id" :title="item.title" :note="item.content">
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import http from "@/common/http.js"
	import user from "@/common/user.js"
	export default {
		data() {
			return {
				questions: [],
				message: '',
			}
		},
		onLoad() {
			this.getQuestion();
		},
		methods: {
			submit() {
				http.request({
					url: '/api/v1/saveProblemFeedback',
					data: {
						"content": this.message,
						"title": "",
						"type": "2",
						"userId": user.getUserId()
					},
					success: ret => {
            uni.showModal({
              showCancel:false,
              title: "提交成功",
              success() {
                uni.reLaunch({
                  url: '../my/my'
                })
              }
            })
					}
				})
			},
			getQuestion() {
				http.request({
					url: '/api/v1/getProblemFeedback',
					success: ret => {
						console.log(ret);
						this.questions = ret;
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.page {
		padding: 45rpx 30rpx;
	}

	.title {
		margin: 20rpx 0;

		.small {
			color: #666666;
		}
	}

	.btn5 {
		margin-bottom: 40rpx;
	}

	.textarea {
		background-color: #e8e8e8;
		padding: 20rpx;
		border-radius: 10rpx;
		margin-top: 10rpx;
		width: 660rpx;
		margin-bottom: 30rpx;
	}
</style>
